package com.itheima.utils;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.Set;

/**
 * 用于测试使用
 */
public class ServletUtil {

    /**
     * 打印请求域的所有数据
     *
     * @param req
     */
    public static void printParameterMap(HttpServletRequest req) {
        Map<String, String[]> parameterMap = req.getParameterMap();
        Set<Map.Entry<String, String[]>> entries = parameterMap.entrySet();
        for (Map.Entry<String, String[]> entry : entries) {
            System.out.println("key:" + entry.getKey() + ", value:" + entry.getValue()[0]);
        }

    }
}
